
# 列表的真正意义的复制

# 1. 假复制  用 =  进行赋值  错误的 复制列表操作
# names = ["Mike","Mary","Jan","Jack"]
# names_源文件 = names
# names.append("Zhichao")
# print("names = ",names)
# print("names_源文件 = ",names_源文件)

# 2. 正确的方法1： copy()
# names = ["Mike","Mary","Jan","Jack"]
# names_源文件 = names.copy()
# names.append("Zhichao")
# print("names = ",names)
# print("names_源文件 = ",names_源文件)

# 3. 正确的方法2： 切片 [:]
names = ["Mike","Mary","Jan","Jack"]
names_源文件 = names[:]
names.append("Zhichao")
print("names = ",names)
print("names_源文件 = ",names_源文件)